package info.douyi.dps.controller;


import info.douyi.dps.model.Bean;
import info.douyi.dps.service.BeansService;
import info.douyi.dps.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Beans")
public class BeansController {

    @Autowired
    private BeansService beansService;

    @GetMapping("/getBeans")
    public Result<List<Bean>> getBeans() {
        List<Bean> beans = beansService.getBeans();
        return Result.success(beans);
    }

    @PostMapping("/insertBean")
    public Result insertBean(@RequestBody Bean bean) {
        beansService.insertBean(bean);
        return Result.success();
    }

}
